let t = require;
let e = module
let o = e.exports;
o.default = e.exports;

'use strict';
console.log("start"),
    Object.defineProperty(o, '__esModule', {
        value: !0
    });
var n = t('MathUtils'),
    i = t('BuffCfg'),
    r = t('ChapterCfg'),
    a = t('ChapterDifficultyCfg'),
    s = t('ConstantCfg'),
    c = t('DropCfg'),
    l = t('MonsterCfg'),
    u = t('ShopCfg'),
    h = t('SoldierItemCfg'),
    p = t('SoldierItemInfo'),
    f = t('CivilizationMrg'),
    d = t('ItemRefreshMrg'),
    g = t('LangCfg'),
    _ = (function () {
        function t() { }
        return (
            (t.calculate = function (e, o) {
                var i = e.crit / 2 / (e.crit + o.solid);
                i = Math.max(i, 0.6);
                var r = Math.random() < i ? 1 : 0,
                    a = e.atk - o.def / 3;
                return (
                    e.level > o.level && (a *= 1.4),
                    1 == r && (a *= 1.5),
                    (a = (a *= t.getDmgFix(e.type, o.type)) < 1 ? 1 : a),
                    (a += n.default.randomInt(0, 3)),
                    [Math.floor(a), r]
                );
            }),
            (t.getDmgFix = function (e, o) {
                return 1 == e ?
                    2 == o ?
                        t.DMG_PARAM1 :
                        3 == o ?
                            t.DMG_PARAM2 :
                            t.DMG_PARAM3 :
                    2 == e ?
                        3 == o ?
                            t.DMG_PARAM1 :
                            1 == o ?
                                t.DMG_PARAM2 :
                                t.DMG_PARAM3 :
                        3 == e ?
                            1 == o ?
                                t.DMG_PARAM1 :
                                2 == o ?
                                    t.DMG_PARAM2 :
                                    t.DMG_PARAM3 :
                            t.DMG_PARAM3;
            }),
            (t.buildMonsterList = function (t) {
                var e = new Array(),
                    o = t.monsterMinLevel,
                    i = t.monsters,
                    s = t.monsterTypes,
                    c = t.bossId,
                    u = r.ChapterCfg.ins.getData(t.chapterId);
                if (1 != u.type) {
                    var h = a.ChapterDifficultyCfg.ins.getDifficultyData(
                        u.id,
                        t.round,
                        f.CivilizationMrg.ins.id
                    );
                    h &&
                        ((o = h.monsterMinLevel), (i = h.monsters), (c = h.bossId));
                }
                for (var p = 0; p < i.length; p++) {
                    for (
                        var d = o + p,
                        g = i[p],
                        _ = l.MonsterCfg.ins.getListByLevel(d),
                        y = 0; y < g; y++
                    ) {
                        var C = n.default.weightsRandom(s);
                        e.push(_[C].id);
                    }
                }
                return (e = n.default.shiffRand(e)), c > 0 && e.push(c), e;
            }),
            (t.getPresetItems = function (t, e) {
                var o = [];
                if (0 == t.presetCount) return o;
                for (; o.length < t.presetCount;) {
                    var i = n.default.weightsRandom(e.itemRands),
                        r = e.itemLevels[i];
                    if (4001 != r && 4002 != r) {
                        var a = n.default.weightsRandom(t.itemTypes) + 1,
                            s = h.SoldierItemCfg.ins.getDataByTypeLevel(a, r);
                        o.push(s.id);
                    }
                }
                if (t.obstacleCount > 0)
                    for (
                        var c = h.SoldierItemCfg.ins.getDatasByType(5), l = 0; l < t.obstacleCount; l++
                    ) {
                        var u = n.default.randomAverage(c);
                        o.push(u.id);
                    }
                return n.default.shiffRand(o);
            }),
            (t.getMonsterMinLevel = function (t) {
                var e = t.monsterMinLevel,
                    o = r.ChapterCfg.ins.getData(t.chapterId);
                if (1 != o.type) {
                    var n = a.ChapterDifficultyCfg.ins.getDifficultyData(
                        o.id,
                        t.round,
                        f.CivilizationMrg.ins.id
                    );
                    n && (e = n.monsterMinLevel);
                }
                return e;
            }),
            (t.getAttributeDesc = function (t, e) {
                void 0 === e && (e = '');
                var o = '';
                return (
                    t.hp > 0 && (o += '+' + t.hp + ' ' + e + '血量\n'),
                    t.atk > 0 && (o += '+' + t.atk + ' ' + e + '攻击\n'),
                    t.def > 0 && (o += '+' + t.def + ' ' + e + '防御\n'),
                    t.crit > 0 && (o += '+' + t.crit + ' ' + e + '暴击\n'),
                    t.solid > 0 && (o += '+' + t.solid + ' ' + e + '坚韧\n'),
                    t.hpPer > 0 && (o += '+' + t.hpPer + '% ' + e + '血量加成\n'),
                    t.atkPer > 0 &&
                    (o += '+' + t.atkPer + '% ' + e + '攻击加成\n'),
                    t.defPer > 0 &&
                    (o += '+' + t.defPer + '% ' + e + '防御加成\n'),
                    o.substring(0, o.length - 1)
                );
            }),
            (t.refreshDailyShopItems = function (t) {
                void 0 === t && (t = !1);
                var e = [],
                    o = n.default.getRandomList(
                        u.ShopCfg.ins.getListByTypeAndKind(1, 1),
                        1
                    );
                e = e.concat(o);
                var i = n.default.getRandomList(
                    u.ShopCfg.ins.getListByTypeAndKind(1, 2),
                    2
                );
                e = e.concat(i);
                var r = n.default.getRandomList(
                    u.ShopCfg.ins.getListByTypeAndKind(1, 3),
                    3
                );
                return e.concat(r);
            }),
            (t.lotteryBoxItems = function (t, e) {
                for (
                    var o = s.ConstantCfg.ins.getBoxDropGroupIds(t),
                    i = [],
                    r = 0; r < o.length; r++
                ) {
                    var a = c.DropCfg.ins.getRandomDropItem(o[r], e);
                    null != a && i.push(a);
                }
                return n.default.shiffRand(i);
            }),
            (t.getChapterRewards = function (t) {
                if (1 == t.type) return t.reward;
                var e = a.ChapterDifficultyCfg.ins.getDifficultyData(
                    t.id,
                    1,
                    f.CivilizationMrg.ins.id
                );
                return e ? e.reward : [];
            }),
            (t.getChapterLoseRewards = function (t) {
                if (1 == t.type) return t.lose;
                var e = a.ChapterDifficultyCfg.ins.getDifficultyData(
                    t.id,
                    1,
                    f.CivilizationMrg.ins.id
                );
                return e ? e.lose : [];
            }),
            (t.getInitBuffList = function (t) {
                if (0 == t.buffs.length) return [];
                for (
                    var e = n.default.randomInt(t.buffs[0], t.buffs[1]),
                    o = i.BuffCfg.ins.getBuffListByRange(1),
                    r = [],
                    a = 0; a < e; a++
                ) {
                    var s = n.default.randomAverage(o);
                    r.push(s.id);
                }
                return r;
            }),
            (t.genRandSoldierItems = function (t) {
                d.ItemRefreshMrg.ins.incTimes();
                const itemList = [];
                const videoItem = d.ItemRefreshMrg.ins.getVideoSoldierItem(t);
                if (videoItem !== null) {
                    itemList.push(videoItem);
                }

                const civilizationData = f.CivilizationMrg.ins.data;
                while (itemList.length < 3) {
                    const randomIndex = n.default.weightsRandom(civilizationData.itemRands);
                    const itemLevel = civilizationData.itemLevels[randomIndex];

                    if (itemLevel !== 4001 && itemLevel !== 4002) {
                        const itemType = n.default.weightsRandom(t.itemTypes) + 1;
                        const itemData = h.SoldierItemCfg.ins.getDataByTypeLevel(itemType, itemLevel);
                        itemList.push(new p.SoldierItemInfo(itemData.id));
                    }
                }

                return n.default.shiffRand(itemList);
            }),
            (t.getCardDesc = function (t) {
                if (t) {
                    for (var e = 97, o = {}, n = 0; n < t.param.length; n++) {
                        o[String.fromCharCode(e++)] = t.param[n];
                    }
                    return g.LangCfg.ins.getContent(t.desc, o);
                }
                return '';
            }),
            (t.Location = [
                cc.v2(-1, 0),
                cc.v2(1, 0),
                cc.v2(0, -1),
                cc.v2(0, 1),
                cc.v2(-1, -1),
                cc.v2(-1, 1),
                cc.v2(1, -1),
                cc.v2(1, 1)
            ]),
            (t.MergeCount = 3),
            (t.AttackCD = 1),
            (t.MoveSpeed = 150),
            (t.WeaponSpeed = 1200),
            (t.VisibleHPBarTime = 2),
            (t.MonsterRoundTime = 1.5),
            (t.SoldierWarCount = 9),
            (t.ColStart = -320),
            (t.ColSpace = 60),
            (t.RowStart = 50),
            (t.RowSpace = 25),
            (t.CardNameOutLineColors = {
                1: '#469B00',
                2: '#00409B',
                3: '#B33900',
                4: '#57008F'
            }),
            (t.GuideSoldierItems = [
                [0, 0, 0, 0, 0, 0],
                [1001, 0, 0, 2002, 2001, 0],
                [1001, 1002, 0, 2002, 0, 0],
                [0, 0, 0, 0, 2001, 0],
                [0, 3002, 3002, 0, 0, 0],
                [0, 0, 0, 3003, 3003, 0]
            ]),
            (t.GuideMergeItems = [1001, 3001, 2001, 1001, 3002]),
            (t.DMG_PARAM1 = 1.2),
            (t.DMG_PARAM2 = 0.8),
            (t.DMG_PARAM3 = 1),
            t
        );
    })();
(o.default = _), console.log("end");
module.exports = e.exports;